clear
close all
A = imread('cameraman.tif');
figure(1);
imshow(A)
[X,Y] = ginput(2);
X=fix(X);
Y=fix(Y);

if abs(X(2)-X(1))<abs(Y(2)-Y(1))
    X(2)= X(1);
else
    Y(2)= Y(1);
end
line(X,Y)
sig=A(Y(1):Y(2),X(1):X(2));
figure,plot(sig)
